package com.lemon.ashe.controller;

import com.lemon.ashe.service.AsheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ashe模块
 *
 * @program: SpringBootZoo
 * @author: Mr.Lemon
 * @create: 2020/6/16
 **/
@RestController
public class AsheController {

    @Autowired
    private AsheService asheService;

    @Value("${lemon.pwd}")
    private String pwd;

    @GetMapping("/pwd")
    public String pwd(){
        return pwd;
    }

    /**
     * 测试类
     *
     * @return
     */
    @GetMapping({"/hello/{id}", "/hello"})
    public String asheTest(@PathVariable("id") Integer id) {
        return null == id ? "hello ash  e" : asheService.hello(id);
    }

    /**
     * 测试类
     *
     * @return
     */
    @GetMapping({"/hello/timeout/{id}", "/hello/timeout"})
    public String asheTimeoutTest(@PathVariable("id") Integer id) {
        return null == id ? "hello ashe" : asheService.hello_timeout(id);
    }
}
